<html>
	<head>
		<title>Newton Game Dynamics DBPro Wrapper v1.53</title>
	</head>
	<body alink="#fa634e" bgcolor="#efeff9" link="#3646fc" text="#000000" vlink="#ff6633">
		<H1>Newton SDK DBPro Wrapper v1.53</H1>
		<P>By Walaber<BR>
		   All Coding between 1.31-1.32B by Kjelle<BR>
		   Updated to 1.53 by Tiresius</P>
        <p><a href="ndb_docs_main.htm">Main Index of Commands</a></p>
		<h2>Introduction</h2>
		<center>
			<table cellspacing="0" width="85%" bgcolor="#ffffff" bordercolorlight="#0506a5" bordercolordark="#0506a5"
				border="1">
				<tr>
					<td bgcolor="#232323"><h3><font color="#fafafa">Newton Game Dynamics</font></h3>
					</td>
				</tr>
				<tr>
					<td bgcolor="#747ff6"><font color="#ffffff" face="monospace">a free physics SDK,
							wrapped for DBPro</FLOAT></font></td>
				</tr>
				<tr>
					<td bgcolor="#fafafa">
						<table border="0" width="95%">
							<tr>
								<td>
									Newton Game Dynamics is a free phsyics simulation library for simulating the
									physical behavior of rigid bodies. The SDK is written in the C language, and is
									very versatile and powerful. I (walaber) take no credit for the design of this
									system. I simply made a DLL which allows Dark Basic Professional developers to
									access this powerful system. For more information on the system itself, I
									suggest you visit the <a href="http://newtondynamics.com">Official Newton
										Website</a>. The author is very helpful, and often visits the forums to
									answer questions and provide information. You will probably see me on the
									forums as well, under the handle "walaber".<br>
									<p>
										<h4>SIMPLE INTRODUCTION TO CONCEPTS USED IN NEWTON</h4>
										Newton requires some basic knowledge of physics in order to be used properly.
										If you have never used a physics engine before, you may find it a bit awkward,
										and counter-intuitive (coming from a traditional game programming perspective).
										This is because when you use a physics system, you have to relenquish a lot of
										"control" over your objects. What this means, is that, for example, you cannot
										directly move objects around by simply setting your location. Although
										technically it is possible in Newton, doing so counters all of the benefits of
										using Newton in the first place. With a little practice, you will become
										comfortable with how to build and control a world using physics, and I promise
										you will be impressed with the results.<br>
										<br>
										Newton works like this: First you setup your world with Newton, telling it what
										kind of objects are in your world, and what properties they have (mass, size,
										etc). Then you assign 3D graphical objects to represent these bodies visually.
										then you control your objects with <b>physics</b>. this means applying forces,
										impulses, etc. to the objects. Newton will automatically update the graphical
										objects to represent what is happening in the world. you <b>do not</b>
									move the objects around like you're probably used to with the position object /
									rotate object commands. But before we go any further, let's have a look at the
									different terminology necessary to deal with physics:
									<p>
										<h4>BASIC TERMINOLOGY</h4>
										Here is a list of basic terms you will need to understand to use Newton (and to
										understand the documentation).<br>
										<table border="0" width="95%">
											<tr>
												<td width="5%"></td>
												<td width="15%">BODY</td>
												<td>a body is the general term used for a RIGID BODY. a rigid body is any solid
													object in your world that interracts with other objects.</td>
											</tr>
											<tr>
												<td width="5%"></td>
												<td width="15%">OBJECT</td>
												<td>In the wrapper documentation, any reference to an "object" refers to the 3D
													model used to visually represent a BODY.</td>
											</tr>
											<tr>
												<td width="5%"></td>
												<td width="15%">VECTOR</td>
												<td>a set of 3 numbers that decribe a position or direction in 3D space.</td>
											</tr>
											<tr>
												<td width="5%"></td>
												<td width="15%">MATRIX</td>
												<td>a set of (usually 16) numbers that describe rotation and translation in 3D
													space.</td>
											</tr>
											<tr>
												<td width="5%"></td>
												<td width="15%">MASS</td>
												<td>a number that describes the "weight" of a body.</td>
											</tr>
											<tr>
												<td width="5%"></td>
												<td width="15%">MOMENT OF INERTIA</td>
												<td>a number that describes the how much a body "resists" rotation on a specific
													axis.</td>
											</tr>
										</table>
										<br>
										...Okay so that was all pretty simple. So back to the matter at hand. When you
										use a physics engine, you can't control your object like you ordinarily would
										in a game. Normally you store the positions and rotations for all of your
										characters / objects, and by changing those variables, you can adjust the
										position of objects, and get them to move around. So why can't you do the same
										with a physics system like Newton? Let's imagine you have a box. you want to
										move the box 10 units to the left. so you manually reset the position of the
										box. Now let's imagine that box, after being moved 10 units left, hits a wall.
										In order to calculate how the ball should react to hitting the ball, Newton
										needs to know the velocity of the ball, where is was a second ago, which way it
										was heading, etc. By manually moving the object, Newton has no way to calculate
										this important data- and thus your box won't react realistically when it hits
										the wall. Instead, you need to leave the actual moving of the objects up to
										Newton, and spend your time telling Newton <b>how</b> to move the objects.
										<br>
										<br>
										But don't worry, Newton provides lots of powerful ways to control your obects
										the <b>right</b> way, with physics.<br>
										<br>
										One thing you will notice is that the game loop in a newton program is
										deceptively simple. in fact, simple programs can have as little as <b>one command</b>
										to handle the physics: <i>NDB_NewtonUpdate</i>. However you will also probably
										notice that the init stage of the program is pretty complex (at least at first
										glance). This is pretty common in physics simulations... the key is setting up
										your bodies properly, with appropriate mass, moment of inertia, and gravity
										values. Although this can at first be a bit daunting, it's actually quite easy
										to get simple physics working with relatively little confusion. If you haven't
										already, have a look at the demos that come with the wrapper. They go in order,
										from simple to more complex. You can learn a lot from these demos, please have
										a look at them.<br>
										<br>
									Well that's about all I think you need to know to get started. Try compiling
									and running the various demos, and then examining the source code to see how
									they are done. And don't forget to check the command reference (if you
									installed the wrapper properly, pressing F1 should bring up the command
									reference) for each command if you're confused. I spent a lot of time on the
									command documentation, and I think it's all you really need to understand the
									system.
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td bgcolor="#dadada"><font face="monospace">Good luck, and please <a href="mailto:tfitzrandolph@yahoo.co.jp">
								LET ME KNOW</a> if you make anything with the wrapper in DBPro!</font></td>
				</tr>
			</table>
			<p></p>
		</center>
	</body>
</html>
